import Vue from 'vue'
import Router from 'vue-router'
import Home from '@/pages/Home/Home'
import City from '@/pages/City/City'
import Detail from '@/pages/Detail/Detail'

Vue.use(Router);

export default new Router({
    // mode:'history',
    routes: [
        {
            path: '/',
            name: 'Home',
            component: Home
        },
        {
            path:'/city',
            name:'City',
            component:City
        },
        {
            path:'/detail/:id',
            name:'detail',
            component:Detail
        }
    ],
    //  每次做页面切换时,让新显示的页面初始位置为(0,0)
    scrollBehavior (to, from, savedPosition) {
        return { x: 0, y: 0 }
    }
})
